<?php

function cp_set_upload_size(){
	define('WP_MEMORY_LIMIT', '10M');
	ini_set('post_max_size', '10M');
	ini_set('upload_max_filesize', '10M');
}


// Localize theme
function cp_localize(){
	load_theme_textdomain( 'cp', LANGUAGEPATH );  // Define a text domain
	$locale = get_locale();
	$locale_file = LANGUAGEPATH . $locale.php;
	if ( is_readable($locale_file) )
	require_once($locale_file);
}

// Set thumnails
function cp_size_image(){
	if (!function_exists('add_theme_support')) {
        add_theme_support( 'post-thumbnails' );
        set_post_thumbnail_size( 200, 150 );
        add_image_size('thumbnail', 200,150, true);
        add_image_size('medium', 410,307, true);
        add_image_size('large', 830,622, true);
	}
}

// Change Excerpt lenght
function cp_set_excerpt_length($length) {
        return 16;
}

// Register Carbon Paper menus 
function cp_set_menus(){
        if ( function_exists( 'register_nav_menus' ) ) {
                register_nav_menus(     array(
                          'main_menu' 	 => 'Carbon Paper Main Menu',
                          'sidebar_menu' => 'Carbon Paper Selection Menu',
                ));
        }
}

// Register legacy comments
function cp_set_legacy_comments($file) {
    if(!function_exists('wp_list_comments')) : // WP 2.7-only check
	    $file = TEMPLATEPATH . '/legacy-comments.php';
    endif;
    return $file;
}


?>